﻿using System;
using System.Diagnostics;
using System.Net;
using System.Runtime.Serialization;

namespace CSC.Google
{
    /// <summary>
    /// PageSpeedData contains all the returned information from the PageSpeed API
    /// </summary>
    [Serializable]
    public class PageSpeedData
    {
        #region Private Variables
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private string kind = string.Empty;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private string id = string.Empty;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private int responseCode = 0;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private string title = string.Empty;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private int score = 0;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private PageStats pageStats = null;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private FormattedResults formattedResults = null;
        [OptionalField, DebuggerBrowsable(DebuggerBrowsableState.Never)]
        private Version version = null;
        #endregion

        /// <summary>
        /// Kind of the API response. Always "pagespeedonline#result"
        /// </summary>
        public string Kind { get { return kind; } }

        /// <summary>
        /// Canonicalized and final URL for the document, after following page redirects (if any).
        /// </summary>
        public string Id { get { return id; } }

        /// <summary>
        /// Response code for the document. 200 indicates a normal page load. 4xx/5xx indicates an error.
        /// </summary>
        public HttpStatusCode ResponseCode { get { return (HttpStatusCode)responseCode; } }

        /// <summary>
        /// Title of the page, as displayed in the browser's title bar.
        /// </summary>
        public string Title { get { return title; } }

        /// <summary>
        /// <para>The Page Speed Score (0-100), which indicates how much faster a page could be.</para>
        /// <para>A high score indicates little room for improvement, while a lower score indicates more room for improvement.</para>
        /// </summary>
        public int Score { get { return score; } }

        /// <summary>
        /// Summary statistics for the page, such as number of JavaScript bytes, number of HTML bytes, etc.
        /// </summary>
        public PageStats PageStats { get { return pageStats; } }

        /// <summary>
        /// Localized Page Speed results. Contains a ruleResults entry for each Page Speed rule instantiated and run by the server.
        /// </summary>
        public FormattedResults FormattedResults { get { return formattedResults; } }

        /// <summary>
        /// The version of the Page Speed SDK used to generate these results.
        /// </summary>
        public Version Version { get { return version; } }




    }
}
